<?php
/**
 * Created by PhpStorm.
 * User: 86188
 * Date: 2020/12/19
 * Time: 16:57
 */

namespace app\admin\controller;


use app\service\webService;
use think\Cache;
use think\facade\Db;

class Web extends Common
{
    public function web(){
        $webinfo=(new webService())->webinfo();
        View::assign("webinfo",$webinfo);
        return View::fetch();
    }

    public function webset(){
        if(request()->isPost()){
            $data=request()->post();

            $res=Db::table("webset")->where("id","1")->update($data);
            if($res){
                Cache::set('webset_notifyurl_alipay',$data['notifyurl_alipay']);
                Cache::set('webset_notifyurl_wechat',$data['notifyurl_wechat']);

                return "修改成功";
            }else{
                return "修改失败";
            }
        }else{
            $webinfo=(new webService())->webinfo();
            View::assign("webinfo",$webinfo);
            return View::fetch();
        }

    }
    public function test(){
        return Cache::get('webset_notifyurl_alipay');;
    }
}